package com.zhenghaijin.recommendationservice.mapper;

import com.zhenghaijin.recommendationservice.model.UserBehavior;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserBehaviorMapper {
    @Insert("INSERT INTO user_behavior(user_id, anime_id, behavior_type, behavior_time) " +
            "VALUES (#{userId}, #{animeId}, #{behaviorType}, #{behaviorTime})")
    void insert(UserBehavior behavior);

    @Select("SELECT anime_id FROM user_behavior WHERE user_id = #{userId}")
    List<Long> getAnimeIdsByUser(Long userId);

    @Select("SELECT user_id FROM user_behavior GROUP BY user_id")
    List<Long> getAllUserIds();
}